var globelLayerOldIndex;

function closeAndNewLayer(options) {
    if (globelLayerOldIndex >= 0) {
        layer.close(globelLayerOldIndex);
    }
    globelLayerOldIndex = layer.open(options);
}
$('body').on('click', '.login', function() { //登录
    closeAndNewLayer({
        type: 1,
        style: 'background:#018c47;font-family:微软雅黑;width:90%',
        content: '<section class="zc">' +
            '<h3>伏蒙商务</h3>' +
            '<div class="zc_form">' +
            '<form><ul class="ulist">' +
            '<li class="group">' +
            '<label class="one" for="phone">' +
            '<input type="text" id="phone" class="txt" placeholder="手机号" maxlength="11">' +
            '<a href="javascript:;" onclick="textclean()">  </a>' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one">' +
            '<input class="txt judge" type="password" id="pass1" onblur="passwordBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<input class="txt" type="text" id="text" style="display:none" onblur="textBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<em  id="togglePassword" onclick="showHidePassword()"></em>' +
            '</label>' +
            '</li>' +
            '<submit class="submit" id="reg-next" onclick="login()">登 录</submit>' +
            '</ul></form>' +
            '<span class="yd"><a style="float:left;" href="javascript:;" class="forget">找回密码？</a><a href="javascript:;" class="register" >注册</a></span></div></div>' +
            '</section>',
        success: function(elem) {
            $('.layui-m-layerchild').append('<div class="close">X</div>');
        }
    })


})

$('body').on('click', '.close', function() {
    layer.closeAll(this);
})
$('body').on('click', '.register', function() { //注册
    closeAndNewLayer({
        type: 1,
        style: 'background:#018c47;font-family:微软雅黑;width:90%',
        content: '<section class="zc">' +
            '<h3>伏蒙商务</h3>' +
            '<div class="zc_form">' +
            '<form><ul class="ulist">' +
            '<li class="group">' +
            '<label class="one" for="phone">' +
            '<input type="text" id="phone" class="txt" placeholder="手机号" maxlength="11">' +
            '<a href="javascript:;" onclick="textclean()">  </a>' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one" for="code">' +
            '<input type="text" id="code" class="txt" placeholder="验证码" maxlength="4">' +
            '<input class="btn btn-small get_code" onclick="sendValidCode(this,\'reg\')" type="button" id="J_getCode" value="获取验证码">' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one">' +
            '<input class="txt judge" type="password" id="pass1" onblur="passwordBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<input class="txt" type="text" id="text" style="display:none" onblur="textBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<em  id="togglePassword" onclick="showHidePassword()"></em>' +
            '</label>' +
            '</li>' +
            '<submit class="submit" id="reg-next" onclick="regUser(this)">注 册</submit>' +
            '</ul></form>' +
            '<span class="yd"><a href="http://www.jinfumeng.com/fumeng/template/agreement.html" target="_blank" style="float:left;">已阅读并同意用户协议</a><a href="javascript:;" class="login">登录</a></span></div>' +
            '</section>',
        success: function(elem) {
            $('.layui-m-layerchild').append('<div class="close">X</div>');
            
        }
    });
})
$('body').on('click', '.forget', function() { //找回密码
    closeAndNewLayer({
        type: 1,
        title: '',
        style: 'background:#018c47;font-family:微软雅黑;width:90%',
        content: '<section class="zc">' +
            '<h3>伏蒙商务</h3>' +
            '<div class="zc_form">' +
            '<form><ul class="ulist">' +
            '<li class="group">' +
            '<label class="one" for="phone">' +
            '<input type="text" id="phone" class="txt" placeholder="手机号" maxlength="11">' +
            '<a href="javascript:;" onclick="textclean()">  </a>' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one" for="code">' +
            '<input type="text" id="code" class="txt" placeholder="验证码" maxlength="4">' +
            '<input class="btn btn-small get_code" onclick="sendValidCode(this,\'forget\')" type="button" id="J_getCode" value="获取验证码">' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one pass">' +
            '<input class="txt pass2 judge" type="password" id="pass1" onblur="passwordBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<input class="txt" type="text" id="text" style="display:none" onblur="textBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<em  id="togglePassword" onclick="showHidePassword()"></em>' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one pass">' +
            '<input class="txt pass2 judge1" type="password" id="pass2" onblur="passwordBlur()" placeholder="确认密码（6-20位字符均可）" maxlength="20"/>' +
            '<input class="txt" type="text" id="text1" style="display:none" onblur="textBlur()" placeholder="确认密码（6-20位字符均可）" maxlength="20"/>' +
            '</label>' +
            '</li>' +
            '<submit class="submit" id="reg-next" onclick="forget()">重置密码</submit>' +
            '</ul></form>' +
            '</div></div>' +
            '</section>',
        success: function(elem) {
            $('.layui-m-layerchild').append('<div class="close">X</div>');
        }
    });
})
$('body').on('click', '.modify', function() { //修改密码
    layer.open({
        type: 1,
        title: '',
        style: 'background:#018c47;font-family:微软雅黑;width:90%',
        content: '<section class="zc">' +
            '<h3>伏蒙商务</h3>' +
            '<div class="zc_form">' +
            '<form><ul class="ulist">' +
            '<li class="group">' +
            '<label class="one code" for="code">' +
            '<input type="text" id="code" class="txt" placeholder="验证码" maxlength="4">' +
            '<input class="btn btn-small get_code" onclick="getCode2(this)" type="button" id="J_getCode" value="获取验证码">' +
            '</label>' +
            '</li>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one pass">' +
            '<input class="txt pass2 judge" type="password" id="pass1" onblur="passwordBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<input class="txt" type="text" id="text" style="display:none" onblur="textBlur()" placeholder="密码（6-20位字符均可）" maxlength="20"/>' +
            '<em  id="togglePassword" onclick="showHidePassword()"></em>' +
            '</label>' +
            '</li>' +
            '<li class="group">' +
            '<label class="one pass">' +
            '<input class="txt pass2 judge1" type="password" id="pass2" onblur="passwordBlur()" placeholder="确认密码（6-20位字符均可）" maxlength="20"/>' +
            '<input class="txt" type="text" id="text1" style="display:none" onblur="textBlur()" placeholder="确认密码（6-20位字符均可）" maxlength="20"/>' +
            '</label>' +
            '</li>' +
            '<submit class="submit" id="reg-next" onclick="init(this)">修改密码</submit>' +
            '</ul></form>' +
            '</div>' +
            '</section>',
        success: function(elem) {
            $('.layui-m-layerchild').append('<div class="close">X</div>');
        }
    });
})


	// 倒计时 Start
//function item(){

    // 倒计时 End
//}